package xc.com.course.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import xc.com.course.domain.*;
import xc.com.course.service.*;
@Service
public class CourseViewServiceImpl implements CourseViewService {
    @Autowired
    private CourseBaseService courseBaseService;
    @Autowired
    private CourseMarketService courseMarketService;
    @Autowired
    private CoursePicService coursePicService;
    @Autowired
    private TeachplanService teachplanService;
    @Override
    public CourseView findByCourse(String courseId) {
        CourseView courseView=new CourseView();
        //根据课程id查询课程信息
        CourseBase courseBase = courseBaseService.findById(courseId);
        courseView.setCourseBase(courseBase);
        //根据课程id查询课程营销信息
        CourseMarket courseMarket = courseMarketService.selectByCourseId(courseId);
        courseView.setCourseMarket(courseMarket);
        //根据课程id查询课程图片信息
        CoursePic coursePic = coursePicService.selectById(courseId);
        courseView.setCoursePic(coursePic);
        //根据课程id查询课程计划信息
        Teachplan[] teachplans = teachplanService.findByCourseId(courseId);
        courseView.setTeachplan(teachplans);
        return courseView;
    }
}
